<?php
/** @var OrdenRequisicionController $this */
/** @var OrdenRequisicion $model */
/** @var AweActiveForm $form */
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
    'type' => 'horizontal',
    'id' => 'orden-requisicion-form',
    'enableAjaxValidation' => false,
    'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false,),
    'enableClientValidation' => true,
        ));
?>

<div class="widget green ">
    <div class="widget-title ">
        <h4>
            <i class="icon-truck"></i><?php echo Yii::t('AweCrud.app', 'Create') . ' ' . OrdenRequisicion::label(); ?>        </h4>
        <span class="tools">
            <a class="icon-chevron-down"></a>
        </span>
    </div>
    <div class="widget-body">
        <p class="note">
            <?php echo Yii::t('AweCrud.app', 'Fields with') ?> <span class="required">*</span>
            <?php echo Yii::t('AweCrud.app', 'are required') ?>.        </p>


        <?php
        echo $form->dropDownListRow($model, 'proveedor_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Proveedor::model()->findAll(), 'id', Proveedor::representingColumn()), array('ajax' => array('type' => 'POST',
                'url' => Yii::app()->baseUrl . '/productos/producto/CargarProducto',
                'update' => '#OrdenRequisicion_producto_id',
            ),
                )
        )
        ?>

        <?php
        echo $form->dropDownListRow($model, 'categoria_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Categoria::model()->findAll(), 'id', Categoria::representingColumn()), array('ajax' => array('type' => 'POST',
                'url' => Yii::app()->baseUrl . '/productos/producto/CargarProducto',
                'update' => '#OrdenRequisicion_producto_id',
            ),
                )
        )
        ?>

        <?php echo $form->dropDownListRow($model, 'producto_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Producto::model()->findAll(), 'id', Producto::representingColumn())) ?>

        <?php echo $form->textFieldRow($model, 'cantidad', array('maxlength' => 10)) ?>
        
        <?php echo $form->textFieldRow($model, 'precio_unitario', array('maxlength' => 10)) ?>

        <div class="form-actions">
            <div class="form-actions-float">
                <?php
                $this->widget('bootstrap.widgets.TbButton', array(
                    'buttonType' => 'submit',
                    'type' => 'primary',
                    'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
                ));
                ?>
                <?php
                $this->widget('bootstrap.widgets.TbButton', array(
                    //'buttonType'=>'submit',
                    'label' => Yii::t('AweCrud.app', 'Cancel'),
                    'htmlOptions' => array('onclick' => 'javascript:history.go(-1)')
                ));
                ?>
            </div>
        </div>
    </div>
</div>
<?php $this->endWidget(); ?>
